package casa.depesos.app.com.http.req;

import android.text.TextUtils;


import org.json.JSONObject;

import java.util.Map;

import casa.depesos.app.com.http.HttpReq;
import casa.depesos.app.com.http.ReqCallback;
import casa.depesos.app.com.http.bean.GetCodeBean;
import casa.depesos.app.com.http.parser.GetCodeParser;
import casa.depesos.app.com.utils.Constant;

public class VerifyReq implements HttpReq<GetCodeBean> {

    @Override
    public void req(ReqCallback<GetCodeBean> callback) {//  /app/riskTask/send
        req("/app/riskTask/submitHazardTask", new GetCodeParser(), callback);
    }

    @Override
    public Map getBody() {
        Map map = HttpReq.super.getBody();
        map.put("reqnum", Constant.getApplyId());
        map.put("mobiTok", Constant.getToken());

        String ids;
        try {
            JSONObject obj = new JSONObject();
            if (!TextUtils.isEmpty(Constant.adid)) {
                obj.put("adid", Constant.adid);
            }
            if (!TextUtils.isEmpty(Constant.instanceId)) {
                obj.put("instanceId", Constant.instanceId);
                obj.put("gpsAdid", Constant.gpsAdid);
                obj.put("adjustGpsAdid", Constant.adjustGpsAdid);
            }
            ids = obj.toString();
        } catch (Throwable e) {
            e.printStackTrace();
            ids = "";
        }
        map.put("tgs", ids);

        return map;
    }
}
